<template>
  <div>
    <el-table-form ref="form" :model="query">
      <el-form-item class="merge-item">
        <el-select v-model="query.type" style="width: 170px; margin-right: 2px;">
          <el-option label="投保单号" value="insureCode" />
          <el-option label="客户编号" value="csmCode" />
          <el-option label="客户名称" value="csmName" />
          <el-option label="备注" value="remark" />
        </el-select>
        <el-input v-model="query.csmText" placeholder="请输入" clearable />
      </el-form-item>
      <el-form-item :table-form-merge="2" class="merge-item">
        <el-select v-model="query.dateType" style="width: 170px; margin-right: 2px;">
          <el-option label="创建日期" value="createTime" />
          <el-option label="变更日期" value="signDt" />
          <el-option label="审核日期" value="transDt" />
        </el-select>
        <el-date-picker
          v-model="query.date"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
      </el-form-item>
      <el-form-item label="客户类型" class="merge-item">
        <el-select v-model="query.csmType">
          <el-option label="请选择" value="-1" />
          <el-option label="居民用户" value="1" />
          <el-option label="非居民用户" value="2" />
          <el-option label="工业用户" value="4" />
          <el-option label="瓶批用户" value="8" />
          <el-option label="槽批用户" value="16" />
        </el-select>
      </el-form-item>
      <el-form-item label="状态" class="merge-item">
        <el-select v-model="query.insureStatus">
          <el-option label="请选择" value="0" />
          <el-option label="未审核" value="1" />
          <el-option label="已审核" value="2" />
          <el-option label="已作废" value="-1" />
        </el-select>
      </el-form-item>
      <el-form-item label="所属机构" class="merge-item">
        <el-select v-model="query.ckOrgSNNo">
          <el-option label="请选择" value="0" />
          <el-option label="未审核" value="1" />
          <el-option label="已审核" value="2" />
          <el-option label="已作废" value="-1" />
        </el-select>
      </el-form-item>
      <el-form-item v-if="type=='changeMessage'" label="变更原因" class="merge-item">
        <el-select v-model="query.insureAddressRemindType" style="width: 170px; margin-right: 2px;">
          <el-option label="请选择" value="-1" />
          <el-option label="地址变更" value="1" />
        </el-select>
      </el-form-item>
      <template v-slot:btns>
        <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
      </template>
    </el-table-form>
  </div>
</template>

<script>
  export default {
    name: 'policyManage',
    props: ['type'],
    data() {
      return {
        query: {
          type: 'insureCode',
          csmText: null,
          dateType: 'createTime',
          date: null,
          csmType: '-1',
          insureStatus: '0',
          ckOrgSNNo: null,
          insureAddressRemindType: '-1'
        }
      }
    },
    methods: {
      search() {
        for (var i in this.query) {
          //   console.log(i)
          if (i === 'type') {
            this.query[this.query.type] = this.query.csmText
          }
        }
        if (this.query.date) {
          this.query.createTime = this.query.date[0]
          this.query.createTimeEnd = this.query.date[1]
        }
        console.log(this.query)
      }
    }
  }
</script>

<style scoped>

</style>
